package com.leostadyn.stackfarm.timestatistics.model.bean;

import android.os.Parcel;
import android.os.Parcelable;

public class EmployeeBean implements Parcelable, Comparable<EmployeeBean> {

    private String uid;
    private String name;
    private String postName;
    
    private double workingHours;

    protected EmployeeBean(Parcel in) {
        uid = in.readString();
        name = in.readString();
        postName = in.readString();
        workingHours = in.readDouble();
    }

    public static final Creator<EmployeeBean> CREATOR = new Creator<EmployeeBean>() {
        @Override
        public EmployeeBean createFromParcel(Parcel in) {
            return new EmployeeBean(in);
        }

        @Override
        public EmployeeBean[] newArray(int size) {
            return new EmployeeBean[size];
        }
    };

    public String getUid() {
        return uid;
    }

    public void setUid(String uid) {
        this.uid = uid;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPostName() {
        return postName;
    }

    public void setPostName(String postName) {
        this.postName = postName;
    }

    public double getWorkingHours() {
        return workingHours;
    }

    public void setWorkingHours(double workingHours) {
        this.workingHours = workingHours;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(uid);
        dest.writeString(name);
        dest.writeString(postName);
        dest.writeDouble(workingHours);
    }


    @Override
    public int compareTo(EmployeeBean o) {
        if (this.workingHours > o.workingHours) {
            return 1;
        } else if (this.workingHours < o.workingHours) {
            return -1;
        } else
            return this.name.compareTo(o.name);
    }
}
